#pragma once

#include<stdio.h>
#include<string.h>
#include<unistd.h>
#include<fcntl.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<stdlib.h>

#define SIZE 1024

//定义刷新方式
#define FLUSH_NONE 0
#define FLUSH_LINE 1
#define FLUSH_FULL 2

struct _OI_FILE
{
    int flag;//刷新方式
    int fileno;//文件描述符
    char outbuffer[SIZE];//缓冲区
    int size;
    int cap;

    //TODO
};

typedef struct _OI_FILE mFILE;

mFILE *mfopen(const char *pathname, const char *mode);
int mfflush(mFILE *_stream);
size_t mfwrite(const void *ptr,int size, mFILE *stream);
int mfclose(mFILE *stream);